//package com.kobeliu.zookeeper;
//
//import lombok.Data;
//import lombok.Value;
//import lombok.extern.slf4j.Slf4j;
////import org.apache.curator.framework.CuratorFramework;
////import org.apache.curator.framework.CuratorFrameworkFactory;
////import org.apache.curator.retry.ExponentialBackoffRetry;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//
//
//@Configuration
//@ConfigurationProperties(prefix = "curator")
//@Data
//@Slf4j
//public class CuratorConfig {
//
//    private String host;
//    private Integer connectionTimeOutMs;
//    private Integer sessionTimeOutMs;
//    private Integer sleepMsBetweenRetry;
//    private Integer maxRetries;
//    private String namespace;
//
//    @Bean("curatorClient")
//    public CuratorFramework getCuratorFramework(){
//
//        log.info("=======================");
//        log.info("namespace:{}",namespace);
//        log.info("=======================");
//
//        //3s后重试仅一次
//        //new RetryOneTime(3000)
//
//        //间隔重连 n 次
//
//
//        //3秒重连一次 总超过10s停止
//        //new RetryUntilElapsed(10000,3);
//
//        // 随着重试次数的增加，间隔时长也增加
//        ExponentialBackoffRetry exponentialBackoffRetry = new ExponentialBackoffRetry(sleepMsBetweenRetry, maxRetries);
//
//        CuratorFramework client = CuratorFrameworkFactory.builder()
//                .connectString(host)
//                .connectionTimeoutMs(connectionTimeOutMs)
//                .sessionTimeoutMs(sessionTimeOutMs)
//                .retryPolicy(exponentialBackoffRetry)
//                .namespace(namespace)
//                .build();
//
//        client.start(); //启动客户端
//
//        return client;
//    }
//}
